import React, { Component } from 'react'

interface stateType {
    name: String | undefined
}

//<any, stateType> 定义属性 定义状态 react特有的类型断言
export default class App extends Component<any, stateType>{
    state = {
        name: '111'
    }
    myref = React.createRef<HTMLInputElement>()
    render() {
        return (
            <div onClick={() => {
                this.setState({
                    name: '12'
                })
            }}>
                <input type="text" ref={this.myref} /> 可点击
            </div>
        )
    }
}
